import request from '@/utils/request'

// 发送信息
export function sendMessage (data) {
  return request({
    url: '/message/sendMessage',
    method: 'post',
    data: data
  })
}

// 根据发送用户和接收用户获取聊天记录
export function findMessageBySendUserAndReceiveUser (sendUserId, receiveUserId) {
  return request({
    url: '/message/findMessageBySendUserAndReceiveUser',
    method: 'get',
    params: {
      sendUserId: sendUserId,
      receiveUserId: receiveUserId
    }
  })
}

// 发送信息
export function sendMessageTo (data) {
  return request({
    url: '/webSocket/sendMessageTo',
    method: 'post',
    data: data
  })
}

// 获取在线人数
export function getOnLineUser () {
  return request({
    url: '/webSocket/getOnLineUser',
    method: 'get',
    params: {}
  })
}

// 发送信息给所有人
export function sendMessageAll (message) {
  return request({
    url: '/webSocket/sendMessageAll',
    method: 'get',
    params: {
      message
    }
  })
}

export function searchUserForForm (loginUserId, searchUserName) {
  return request({
    url: '/message/searchUserForForm',
    method: 'get',
    params: {
      loginUserId: loginUserId,
      searchUserName: searchUserName
    }
  })
}

export function botQuest (question) {
  return request({
    url: '/bot/quest',
    method: 'get',
    params: {
      question: question
    }
  })
}
